Skip to content

Conversation

@alukach
Copy link
Member

@alukach alukach commented Nov 13, 2025

This PR attempts to normalize the interface between Python and WASM runtimes.

cql2::Expr

Currently, we expose the cql2::Expr struct as CQL2 in WASM but Expr in Python. This PR alters the WASM library to expose cql2::Expr as Expr.

Expr.matches(item) and Expr.reduce(item)

Currently, the WASM library expects strings to be passed into Expr.matches(item) and Expr.reduce(item) while the Python module expects dict instances. This PR alters the WASM library to expect JS Values (aka POJOs) in the Expr.matches(item) and Expr.reduce(item) methods.

Expr.to_json()

Currently, the WASM library returns a string from Expr.to_json() while the Python module returns a dict instance. This PR alters the WASM library to return JS Values from Expr.to_json().

Note

Expr.to_pretty_json() still returns a string, which is a bit awkward but there's no such thing as a pretty JS value.

@alukach alukach requested review from bitner and gadomski November 13, 2025 00:08
Copy link
Collaborator

@gadomski gadomski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a ### Changed entry to the CHANGELOG? We probably need a PR template to remind folks of that, as well.

@alukach alukach force-pushed the refactor/wasm/use-expr branch from 82e8534 to 557be88 Compare November 13, 2025 00:31
@alukach alukach marked this pull request as draft November 13, 2025 00:32
@alukach alukach changed the title refactor(wasm)!: Expose CQL2Expression as Expr rather than CQL2 refactor(wasm)!: Make WASM module interface more like Python module Nov 13, 2025
@alukach alukach marked this pull request as ready for review November 13, 2025 21:08
@alukach alukach requested a review from gadomski November 13, 2025 21:13
@alukach
Copy link
Member Author

alukach commented Nov 13, 2025

@gadomski not sure why that last build failed but I think we're good to go now

@alukach alukach merged commit d2b71d9 into main Nov 14, 2025
17 of 18 checks passed
@alukach alukach deleted the refactor/wasm/use-expr branch November 14, 2025 15:51
@kylebarron
Copy link
Member

At some point I'd love to look into your wasm bindings in more detail!

@github-actions github-actions bot mentioned this pull request Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants